# *****************************************************
# 实验文件夹: 03_classes_and_objects
# 李承硕
# *****************************************************

class Hanzi:
    # 类变量（相当于 static var count）
    count = 0

    def __init__(self, radical: str, component: str):
        self.radical = radical
        self.component = component
        Hanzi.count += 1  # 相当于 count++

    def compose(self) -> str:
        return self.radical + self.component


def main():
    h1 = Hanzi("氵", "青")
    h2 = Hanzi("亻", "言")
    h3 = Hanzi("口", "马")

    print("组合的汉字有：")
    print(h1.compose())
    print(h2.compose())
    print(h3.compose())

    print(f"共组合了{Hanzi.count}个汉字")


if __name__ == "__main__":
    main()
